home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctjjl86.arc
/
ANIMATE.ARC
/
OPTXOR.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-04-16
|
2KB
|
65 lines
; *** Listing 5 ***
;
;Optimized XOR graphics driver for putting rectangular images into
; the Color/Graphics Adapter's medium-resolution memory map.
;
; Note: AX,BX,CX,DX,BP,SI,DI destroyed.
;
one segment para public 'CODE'
assume cs:one,ds:one,es:nothing
public form_driver
;
form_driver proc near
mov di,[bx+even_line_screen_offset_table] ;find offset of
; top line of image
add di,cx ;ES:DI now points to byte at which to put
; the image's upper left corner
lodsb ;get the height of the image
shr al,1 ;divide by 2 to arrive at number of even/odd
; line pairs in the image
mov ah,al ;store count in AH
lodsb ;get the width of the image in bytes
mov bl,al ;put width in BL
sub bh,bh ;make width a 16 bit value
mov bp,2000h ;calculate the amount to add after even scan
sub bp,bx ; lines are drawn to get to address of the
; next scan line
mov dx,1fb0h ;calculate amount to subtract after odd scan
add dx,bx ; lines are drawn to get to address of the
; next scan line
;
next_two_lines:
mov cx,bx ;set the number of bytes/line for the form
next_column_for_even_row:
lodsb ;get the next image byte
xor es:[di],al ;exclusive-OR it into screen memory
inc di ;point to next screen memory position
loop next_column_for_even_row ;loop for next byte
; on even line
add di,bp ;calculate address to start next line of image
mov cx,bx ;reset the number of bytes/line for an odd row
next_column_for_odd_row:
lodsb ;get the next image byte from the form
xor es:[di],al ;exclusive-OR onto screen
inc di ;advance screen memory pointer
loop next_column_for_odd_row ;loop for nxt byte on odd line
sub di,dx ;calculate the address to start next line
; of image--next line will be an even line
dec ah ;count down number of line pairs
jne next_two_lines ; jmp if any even/odd line pairs left
ret ; if not, return to calling program
;
;This table is used to find the offset of an even scan line in
; the memory map of the color graphics adapter in medium res mode.
;
even_line_screen_offset_table label word
x=0
rept 100 ;there are 100 even lines
dw x*50h ; each is 50h (80 decimal) long
x=x+1
endm
;
form_driver endp
one ends
end